<?php

namespace app\index\controller;

use app\index\model\Banner;
use app\index\model\CompanyNews as CompanyNewsModel;
use app\index\model\Nav;
use app\index\model\Nav as NavModel;
use think\Request;

class Index extends BaseController
{

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
    }


    /**
     * 首页
     * @return string
     * @throws \think\Exception
     */
    public function index(NavModel $navModel)
    {
        //企业新闻
        $news = CompanyNewsModel::getRecommend();
        //轮播图
        $banners = Banner::getBanners('index');

        $this->assign('news', $news);
        $this->assign('banners', $banners);
        return $this->view->fetch();
    }


    private function errorPage($page)
    {
        if (!$page) {
            $this->error('页面丢失', null, '', 1);
        }
    }
}
